<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~    http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<banner-text>
    <div class="flex flex-col h-full">
        <header class="mb-5 nifi-header">
            <navigation></navigation>
        </header>
        <div class="pb-5 px-5 flex-1 flex flex-col">
            <h3 class="primary-color">NiFi Cluster</h3>
            <context-error-banner [context]="ErrorContextKey.CLUSTER"></context-error-banner>
            <div class="flex flex-col h-full gap-y-2">
                @if (getTabLinks(); as tabs) {
                    <!-- Don't show the tab bar if there is only 1 tab to show -->
                    <div class="cluster-tabs" [class.hidden]="tabs.length === 1">
                        <nav mat-tab-nav-bar [tabPanel]="tabPanel">
                            @for (tab of tabs; track tab) {
                                <a
                                    mat-tab-link
                                    [routerLink]="[tab.link]"
                                    routerLinkActive
                                    #rla="routerLinkActive"
                                    [active]="rla.isActive">
                                    {{ tab.label }}
                                </a>
                            }
                        </nav>
                    </div>
                }
                <div class="mt-4 flex-1">
                    <mat-tab-nav-panel #tabPanel>
                        <router-outlet></router-outlet>
                    </mat-tab-nav-panel>
                </div>

                <div class="flex justify-between align-middle">
                    <div class="text-sm flex items-center gap-x-2">
                        <button mat-icon-button class="primary-icon-button" (click)="refresh()">
                            <i
                                class="fa fa-refresh"
                                [class.fa-spin]="
                                    listingStatus() === 'loading' || systemDiagnosticsStatus() === 'loading'
                                "></i>
                        </button>
                        <div>Last updated:</div>
                        <div class="tertiary-color font-medium">{{ loadedTimestamp() }}</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</banner-text>
